package com.admin.education.models;

import com.admin.education.repositories.Identifiable;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

@Entity
@Table(name = "menus")
@EntityListeners(AuditingEntityListener.class)
@Data
public class Menus implements Serializable,Identifiable {
    @Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    @Column(name = "answer_description")
    @NotBlank
    @Length(max=12)
    @NotNull
    private String menuCode;
    @Column(name = "menu_name")
    @NotBlank
    @Length(max=64)
    @NotNull
    private String menuName;
    @Column(name = "parent_menu_code")
    @Length(max=12)
    private String parentMenuCode;
    @Column(name = "menu_order")
    @NotNull
    private int menuOrder;
    @Column(name = "url")
    @NotBlank
    @Length(max=1024)
    private String url;
    @Column(name = "culture")
    @NotBlank
    @Length(max=8)
    private String culture;
    @ManyToMany
    private List<Role> roles;
}